package com.xjs.controller;

import com.xjs.annotation.AccessLimit;
import com.xjs.entity.Order;
import com.xjs.id.Uid;
import com.xjs.service.RabbitProducerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class ProducerController {

    @Autowired
    private RabbitProducerService rabbitProducerService;

    @AccessLimit(maxCount = 2,seconds = 1)
    @GetMapping("test")
    public String test(){
        return "测试接口降幂";
    }

    /**
     * @Description 测试消息发送
     * @UserModule: exam-web-paper
     * @param
     * @return void
     */
    @GetMapping("send")
    public void send(){
        Order order= Order.builder().id(Uid.getUidInt()).messageId(Uid.getUid()).name(Uid.getUid()).build();
        rabbitProducerService.topicSend(order);
    }
}
